<!doctype html>
<html lang="en">
<head>
    <title>Recaf - modern bytecode editor</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta name="description" content="Recaf is a modern java bytecode editor using Objectweb's ASM and JavaFX.">
	<meta name="keywords" content="java,bytecode,editor,recaf,reverse engineering">
	<link rel="icon" type="image/x-icon" href="favicon.ico"/>
    <link rel="stylesheet" href="css/font/roboto300.css">
    <link rel="stylesheet" href="css/pure/pure-min.css">
    <link rel="stylesheet" href="css/pure/grids-responsive-min.css">
    <link rel="stylesheet" href="css/scroll.css">
    <link rel="stylesheet" href="css/common.css">
    <link rel="stylesheet" href="css/menu.css">
    <link rel="stylesheet" href="css/code.css">
    <link rel="stylesheet" href="css/docs.css">
    <script src="js/jquery.min.js"></script>
</head>
<body id="root">
<header class="pure-menu pure-menu-horizontal">
    <a href="index.html"><div class="logo"></div></a>
    <nav>
        <ul class="pure-menu-list">
            <li class="pure-menu-item pure-menu-selected"><a href="documentation.html" class="pure-menu-link">Documentation</a></li>
            <li class="pure-menu-item"><a href="features.html" class="pure-menu-link">Features</a></li>
            <li class="pure-menu-item"><a href="https://github.com/Col-E/Recaf" class="pure-menu-link">Github</a></li>
        </ul>
    </nav>
</header>
<article>
    <div id="sidebar" class="column">
        <div class="pure-menu">
            <ul class="pure-menu-list">
                <li class="pure-menu-item"><span class="parent-menu">Setup</span>
                    <ul class="pure-menu-sub-list">
                        <li class="pure-menu-item"><a href="doc-setup-get.html" class="pure-menu-link">Getting Recaf</a></li>
                        <li class="pure-menu-item"><a href="doc-setup-8.html" class="pure-menu-link">Java 8</a></li>
                        <li class="pure-menu-item"><a href="doc-setup-11.html" class="pure-menu-link">Java 11+</a></li>
                    </ul>
                </li>
                <li class="pure-menu-item"><span class="parent-menu">Introduction</span>
                    <ul class="pure-menu-sub-list">
                        <li class="pure-menu-item"><a href="doc-intro-workspace.html" class="pure-menu-link">Workspaces</a></li>
                        <li class="pure-menu-item"><a href="doc-intro-config.html" class="pure-menu-link">Config</a></li>
                    </ul>
                </li>
                <li class="pure-menu-item"><span class="parent-menu">Searching</span>
                    <ul class="pure-menu-sub-list">
                        <li class="pure-menu-item"><a href="doc-search-string.html" class="pure-menu-link">Strings</a></li>
                        <li class="pure-menu-item"><a href="doc-search-value.html" class="pure-menu-link">Values</a></li>
                        <li class="pure-menu-item"><a href="doc-search-ref-class.html" class="pure-menu-link">Class references</a></li>
                        <li class="pure-menu-item"><a href="doc-search-ref-member.html" class="pure-menu-link">Member references</a></li>
                        <li class="pure-menu-item"><a href="doc-search-dec-member.html" class="pure-menu-link">Member declarations</a></li>
                        <li class="pure-menu-item"><a href="doc-search-instruction.html" class="pure-menu-link">Instructions</a></li>
                    </ul>
                </li>
                <li class="pure-menu-item"><span class="parent-menu">Editing</span>
                    <ul class="pure-menu-sub-list">
                        <li class="pure-menu-item"><a href="doc-edit-modes.html" class="pure-menu-link">Class modes</a></li>
                        <li class="pure-menu-item"><a href="doc-edit-mode-decompile.html" class="pure-menu-link">Decompile mode</a></li>
                        <li class="pure-menu-item"><a href="doc-edit-mode-table.html" class="pure-menu-link">Table mode</a></li>
                        <li class="pure-menu-item"><a href="doc-edit-mode-hex.html" class="pure-menu-link">Hex mode</a></li>
                        <li class="pure-menu-item"><a href="doc-edit-assembler.html" class="pure-menu-link">Assembler</a></li>
                        <ul class="pure-menu-sub-list">
                            <li class="pure-menu-item"><a href="doc-edit-assembler-errors.html" class="pure-menu-link">Errors</a></li>
                        </ul>
                    </ul>
                </li>
                <li class="pure-menu-item"><span class="parent-menu">Advanced</span>
                    <ul class="pure-menu-sub-list">
                        <li class="pure-menu-item"><a href="doc-advanced-theme.html" class="pure-menu-link">Themes</a></li>
                        <li class="pure-menu-item"><a href="doc-advanced-plugin.html" class="pure-menu-link">Plugins</a></li>
                        <li class="pure-menu-item"><a href="doc-advanced-scripting.html" class="pure-menu-link">Scripting</a></li>
                    </ul>
                </li>
            </ul>
        </div>
    </div>
    <div id="content" class="column">
        <h1 id="plugin-api">Plugin API</h1>
        <h2 id="installing-plugins">Installing plugins</h2>
        <p>To install a plugin for Recaf, drop it into the <em>&quot;plugins&quot;</em> directory inside Recaf&#39;s settings directory. When you launch Recaf check to see if the plugin has been loaded by looking for it in the plugin manager <em>(&quot;Plugins &gt; Manage plugins&quot;)</em>. If the plugin is missing, check the log output for errors and contact the plugin author with a bug report.</p>
        <h2 id="current-plugins">Current plugins</h2>
        <p>This section is currently incomplete. For now you can find all the current plugins hosted in the <a href="https://discord.gg/Bya5HaA">Recaf Discord server</a>.</p>
        <h2 id="developing-plugins">Developing plugins</h2>
        <p>Recaf comes with a plugin system. You can create your own easily by setting up a workspace using this template project: <a href="https://github.com/Col-E/Recaf-plugin-workspace">Recaf-plugin-workspace</a>
        The plugin api interfaces are located in <code>me.coley.recaf.plugin.api</code> package. Your plugin must implement one of the following interfaces:</p>
        <p><strong>BasePlugin</strong></p>
        <ul>
        <li>No unique behavior.</li>
        </ul>
        <p><strong>CommandPlugin</strong></p>
        <ul>
            <li>Allows adding new commands to Recaf’s command-line mode.</li>
            <li>Commands are generated using <a href="https://picocli.info/">picocli</a> annotations. Simply annotate your class as described on <a href="https://picocli.info/">picocli’s website</a> and the command will be automatically recognized.</li>
        </ul>
        <p><strong>ConfigurablePlugin</strong></p>
        <ul>
            <li>Allows plugins to keep persistent config values. Each plugin is granted its own tab in the config window.<ul>
            <li>Annotate config fields with <code>@Conf(value=&quot;Title&quot;, noTranslate=true)</code></li>
            <li>Specify the config tab name by implementing getConfigTabTitle()</li>
            <li>Optional:
            <ul>
                <li>Specify custom serialization/deserialization for fields using <code>supported(Class)</code>, <code>loadType(FieldWrapper, Class, JsonValue)</code>, <code>saveType(FieldWrapper, Object, JsonObject)</code></li>
                <li>Specify custom UI components for displaying fields using <code>addFieldEditors(Map)</code>
                <ul>
                    <li>By default, any <code>boolean</code>, <code>enum</code>, or <code>Binding</code> <em>(Recaf keybind type)</em> field will automatically have editor controls specified.</li>
                </ul>
                </li>
            </ul>
            </li>
            </ul>
            </li>
        </ul>
        <p><strong>ContextMenuInjectorPlugin</strong></p>
        <ul>
            <li>Allows modifying any of the context-menus shown in Recaf.</li>
        </ul>
        <p><strong>EntryLoaderProviderPlugin</strong></p>
        <ul>
            <li>Allows the usage of custom archive entry handlers.
            <ul>
                <li>Entry loaders are fed the raw <code>byte[]</code> of all files in an archive.</li>
            </ul>
            </li>
        </ul>
        <p><strong>ExportInterceptorPlugin</strong></p>
        <ul>
            <li>Allows the contents of exported files to be modified before being written to the destination.</li>
        </ul>
        <p><strong>KeybindProviderPlugin</strong></p>
        <ul>
            <li>Allows plugins to specify custom keybinds globally, for class-views, and for file-views.</li>
        </ul>
        <p><strong>LoadInterceptorPlugin</strong></p>
        <ul>
            <li>Allows the contents of imported files to be modified before being loaded into a Recaf resource.
            <ul>
                <li>This is different from the <code>EntryLoaderProviderPlugin</code> since there is no per-resource context of loaded items.</li>
            </ul>
            </li>
        </ul>
        <p><strong>MenuProviderPlugin</strong></p>
        <ul>
            <li>Allows the plugin to create a custom menu item to be shown under the plugins menu.</li>
        </ul>
        <p><strong>StartupPlugin</strong></p>
        <ul>
            <li>Allows the plugin to notified when Recaf starts up.
            <ul>
                <li>The plugin is also given access to the controller instance.</li>
            </ul>
            </li>
        </ul>
        <p><strong>WorkspacePlugin</strong></p>
        <ul>
            <li>Allows the plugin to notified when Recaf opens new workspaces and closes old ones.</li>
        </ul>
        <h2 id="compiling-the-custom-plugin">Compiling the custom plugin</h2>
        <p>After creating your plugin compile it using <code>mvn clean package</code>. This will generate a jar file in the target directory. Copy this into Recaf’s plugin directory.</p>
        <center><img src="screenshots/template-plugin.png"></center>
        <br id="spacing-hack">
    </div>
</article> 
</body>
</html>
